<template>
  <a v-if="isShow" href="javascript:;" @click="gotoDetail()" :style="{color:theme}"><slot></slot></a>
  <span v-else ><slot></slot></span>
</template>

<script>
export default {
  name:"MyLink",
  data() {
    return {
    };
  },
  props:{
    href:{
      type:String,
      default:""
    },
    handle:{
      type:String,
      default:""
    }
  },
  computed:{
    isShow(){
      return this.handle?this.hasPermissions(this.handle):true
    },
    theme() {
      return this.$store.state.baseSettings.theme;
    },
  },
  watch: {
  },
  created() {
  },
  methods: {
    gotoDetail(){
      if(this.href){
        window.open(`${process.env.VUE_APP_BASE_API}${this.href}`)
      }else{
        this.$emit('to')
      }
    },
  }
};
</script>
